package com.tanhua.server.service;

import com.tanhua.domain.db.PageResult;
import com.tanhua.domain.vo.InfoVo;
import com.tanhua.domain.vo.UserInfoVo;
import com.tanhua.dubbo.api.BlackApi;
import com.tanhua.server.utils.ThreadLocalUtils;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class BlackService {

    //订阅lackAPi
    @Reference
    private BlackApi blackApi;
//    注入ThreadLocalUtils对象
    @Autowired
    private ThreadLocalUtils threadLocalUtils;

    /**
     * 查看黑名单列表
     * @param page
     * @param pagesize
     * @return
     */
    public PageResult<InfoVo> findBalckList(Long page, Long pagesize) {
//        获取当前的用户ID
        Long userId = threadLocalUtils.getUserId();
//        调用接口服务 传入查询条件
        return  blackApi.findBalckList(userId,page,pagesize);
}
    /**
     * 移除黑名单
     */
    public void delBalckList(Long uid) {
//        获取到当前的用户
        Long userId = threadLocalUtils.getUserId();
//        调用方法 传入两个参数
        blackApi.delBalckList(userId,uid);
    }

}
